package de.hdu.pms.ho.model;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.type.TimestampType;

/**
 * Basis class {@link Kunde} which includes all properties of {@link Kunde}
 * 
 * Following specifications will be declared:
 * <ul>
 * <li>id -- primary key</li>
 * <li>created -- date of creation</li>
 * <li>name</li>
 * <li>surname</li>
 * <li>street</li>
 * <li>town/city</li>
 * <li>postal zip id</li>
 * <li>telephone</li>
 * <li>IBAN No.</li>
 * <li>SWIFT No.</li>
 * </ul>
 * 
 * @author Hendrik Neumann
 */

@Entity
@Table(name = "Kunde")
public class Kunde {
	@Id
	@GeneratedValue
	@Column(name = "pk_kunde")
	private Integer id;
	private Date created;
	private TimestampType timestamp; 
	private String name;
	private String vorname;
	private String strasse;
	private String ort;
	private String plz;
	private String telefonnummer;
	private Integer kontonummer;
	private Integer bankleitzahl;
	
//	@OneToMany
//	private Set<ZimmerKunde> zimmerKunde;
	
	public Kunde() {
		created = new Date();
	}
		
	/**
	 * Constructor for testing class
	 * @param v
	 * @param n
	 * @param k
	 */
	public Kunde(String v, String n, Integer k) {
    	vorname = v;
    	name = n;
    	kontonummer = k;
	}
	
	/* 
	 * Tests, if the primary key in the database is unique 
	 */
	@Override
    public boolean equals(Object o) {
    	return id == ((Kunde) o).getId();
    }
	
	/* 
	 * Getter Methods and Setter Methods 
	 */
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getVorname() {
		return vorname;
	}

	public void setVorname(String vorname) {
		this.vorname = vorname;
	}

	public String getStrasse() {
		return strasse;
	}

	public void setStrasse(String strasse) {
		this.strasse = strasse;
	}

	public String getOrt() {
		return ort;
	}

	public void setOrt(String ort) {
		this.ort = ort;
	}

	public String getPlz() {
		return plz;
	}

	public void setPlz(String plz) {
		this.plz = plz;
	}

	public String getTelefonnummer() {
		return telefonnummer;
	}

	public void setTelefonnummer(String telefonnummer) {
		this.telefonnummer = telefonnummer;
	}

	public Integer getKontonummer() {
		return kontonummer;
	}

	public void setKontonummer(Integer kontonummer) {
		this.kontonummer = kontonummer;
	}

	public Integer getBankleitzahl() {
		return bankleitzahl;
	}

	public void setBankleitzahl(Integer bankleitzahl) {
		this.bankleitzahl = bankleitzahl;
	}

	public TimestampType getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(TimestampType timestamp) {
		this.timestamp = timestamp;
	}

	public String getktonrString() {
		return ""+this.kontonummer;	
	}
	public String getblzString() {
		return ""+this.bankleitzahl;	
	}
}
